$(function(){
	$().ready(function(){
		layer.msg('欢迎来到唐春的八字排盘页面！');
			});
	// $("#select").click(function() {
	// 	select();
	// });
	// $("#yonghu").on("click",function(){
	// 	layer.msg('请输入用户名和密码！');
	// });
	$("#right").on("click",function(){
		layer.msg('下一周的班列信息！');
	});
	$("#quyongshen").click(function(){
		quyongshen();
	});
});
function quyongshen() {
	// 第一步 直接查询 
	var a = $("#a").val();
	var b = $("#b").val();
	var c = $("#c").val();
	var d = $("#d").val();
	console.log(a);console.log(b);console.log(c);console.log(d);
	var url = "http://localhost:8094/yongshen/qu";
	// 请求参数
	var params = {a:a,b:b,c:c,d:d};
	$.ajax({
		//请求方式
		async: true,
		//提交方式
		type: "POST",
		//服务器返回的数据格式
		dataType: "json",
		//请求的URL
		url: url,
		//请求参数
		data: params,
		//回调函数,取得数据并显示
		success: function(data) {
			if (null != data) {
					display(data);
			} else {
				layer.msg('服务器返回对象为空！检查服务器程序！');
				
			}
		},
		//请求失败时被调用的函数,如请求的url不正确等
		error: function() {
			layer.msg('发起请求失败！检查请求参数和方法！');
		}
	});
}
function display(data) {
	var i=0;
	$(".layui-container div:nth-of-type(1) div:nth-of-type(1)").html(data.first[i]);
	$(".layui-container div:nth-of-type(1) div:nth-of-type(2)").html(data.first[i+1]);
	$(".layui-container div:nth-of-type(1) div:nth-of-type(3)").html(data.first[i+2]);
	$(".layui-container div:nth-of-type(1) div:nth-of-type(4)").html(data.first[i+3]);
	
	$(".layui-container div:nth-of-type(2) div:nth-of-type(1)").html(data.second[i]);
	$(".layui-container div:nth-of-type(2) div:nth-of-type(2)").html(data.second[i+1]);
	$(".layui-container div:nth-of-type(2) div:nth-of-type(3)").html(data.second[i+2]);
	$(".layui-container div:nth-of-type(2) div:nth-of-type(4)").html(data.second[i+3]);
	
	$(".layui-container div:nth-of-type(3) div:nth-of-type(1)").html(data.third[i]);
	$(".layui-container div:nth-of-type(3) div:nth-of-type(2)").html(data.third[i+1]);
	$(".layui-container div:nth-of-type(3) div:nth-of-type(3)").html(data.third[i+2]);
	$(".layui-container div:nth-of-type(3) div:nth-of-type(4)").html(data.third[i+3]);
	
	$(".layui-container div:nth-of-type(4) div:nth-of-type(1)").html(data.four[i]);
	$(".layui-container div:nth-of-type(4) div:nth-of-type(2)").html(data.four[i+1]);
	$(".layui-container div:nth-of-type(4) div:nth-of-type(3)").html(data.four[i+2]);
	$(".layui-container div:nth-of-type(4) div:nth-of-type(4)").html(data.four[i+3]);

	$(".layui-container div:nth-of-type(5) div:nth-of-type(1)").html(data.five[i]);
	$(".layui-container div:nth-of-type(5) div:nth-of-type(2)").html(data.five[i+1]);
	$(".layui-container div:nth-of-type(5) div:nth-of-type(3)").html(data.five[i+2]);
	$(".layui-container div:nth-of-type(5) div:nth-of-type(4)").html(data.five[i+3]);
	$("#th").html(data.th);
	$("#thshen").html(data.thshen);
}